<template>
  <div class="page-common-layout">
    <div class="page-common-left" style="width:30%">
      <s-table
        ref="table"
        size="small"
        :columns="$toI18nFormat(columns)"
        :data="loadData"
        rowKey="name"
        :showPagination="false"
        @rowClick="rowClick"
        :rowClassName="rowClassName"
      >
        <span
          v-for="(item, index) in $toI18nFormat(columns)"
          :slot="item.slotName"
        >
          <span :key="index">{{ $ct(item.slotName, item.defaultTitle) }}</span>
        </span>
      </s-table>
    </div>
    <div class="page-common-content">
      <tool-bar>
        <template slot="toolBtn" slot-scope="scope">
          <a-button
            class="cu-btn-primary"
            icon="plus"
            @click="handleAddDic"
            v-action:ossAddDialog
            >{{ $ct("ossAddDialog", "新增目录") }}</a-button
          >
          <a-button
            class="cu-btn-success"
            icon="upload"
            @click="handleUpLoad()"
            v-action:ossUploadDialog
            >{{ $ct("minioUploadDialog", "批量上传") }}</a-button
          >
          <a-button
            class="cu-btn-orange"
            icon="rollback"
            @click="handleBack()"
            v-action:ossBackDialog
            >{{ $ct("minioBackDialog", "返回") }}</a-button
          >
          <a-button
            class="cu-btn-info"
            icon="swap"
            @click="handleChangeFile"
            v-action:ossChangeStorageSpaceDialog
            >{{ $ct("ossChangeStorageSpaceDialog", "更改存储空间") }}</a-button
          >
          <a-button
            class="cu-btn-empty"
            icon="swap"
            @click="handleChangeFileCatalog"
            v-action:ossChangeFileCatalogDialog
            >{{ $ct("ossChangeFileCatalogDialog", "更改文件目录") }}</a-button
          >
          <a-button
            class="cu-btn-danger"
            icon="delete"
            @click="handleSub()"
            v-action:ossDelDialog
            >{{ $ct("delete", "删除") }}</a-button
          >
          <a-button-group v-if="fileCatalog">
            <a-button
              type="primary"
              icon="check"
              @click="handleOkFileCatalog()"
            />
            <a-button
              type="primary"
              icon="close"
              @click="
                () => {
                  fileCatalog = null;
                }
              "
            />
          </a-button-group>
        </template>
      </tool-bar>
      <!-- <data-grid
			  ref="subList"
			  :columns="columnsDicItem"
			  :url="url"
			  rowKey="uuid"
			  showPagination="auto"
			  :queryParam="queryParamDicItem"
			>
			  <span slot="objectName" slot-scope="{ text, record }">
			    <template v-if="!record.isFile">
			      <icon-fonts icon="icon-wenjianjia" />
			      <a @click="handleLoadData(record)">
			        {{ text | objectNameFilter }}</a
			      >
			    </template>
			    <template v-else>
			      <t-ellipsis :value="text">
			        <template slot="content">
			          <icon-fonts :icon="getIconFonts(record.objectName)" />
			          <a
			            @click="
			              () => {
			                handleDownLoad(record);
			              }
			            "
			          >
			            {{ text | objectNameFilter }}</a
			          >
			        </template>
			      </t-ellipsis>
			    </template>
			  </span>
			  <span slot="storageClass" slot-scope="{ text, record }">
			    {{ text | storageClassFilter }}
			  </span>
			  <span slot="action" slot-scope="{ text, record }">
			    <template v-if="record.isFile">
			      <a
			        v-if="showPreview(record)"
			        @click="
			          () => {
			            handlePreview(record);
			          }
			        "
			        >预览</a
			      >
			      <a-divider type="vertical" v-if="showPreview(record)" />
			      <a @click="handleView(record)">详情</a>
			      <span class="action-margin"></span>
			      <a @click="handleDownLoad(record)">下载</a>
			      <template v-if="showTypePreview(record)">
			        <span class="action-margin"></span>
			        <a @click="getViewUrlWebPath(record)">在线编辑</a>
			      </template>
			    </template>
			  </span>
			</data-grid> -->
      <div style="height: calc(100% - 40px - 47px);">
        <a-table
          ref="subList"
          size="small"
          :columns="$toI18nFormat(columnsDicItem)"
          :data-source="dataSource"
          :rowSelection="rowSelectionDic"
          rowKey="uuid"
          showPagination="auto"
          :pagination="pagination"
          @change="handleTableChange"
          :scroll="scrollXY"
        >
          <span
            v-for="(item, index) in $toI18nFormat(columnsDicItem)"
            :slot="item.slotName"
          >
            <span :key="index">{{
              $ct(item.slotName, item.defaultTitle)
            }}</span>
          </span>
          <span slot="renderSerial" slot-scope="text, record, index">
            {{ index + 1 }}
          </span>
          <span slot="renderObjectName" slot-scope="text, record">
            <template v-if="!record.isFile">
              <icon-fonts icon="icon-wenjianjia" />
              <a @click="handleLoadData(record)">
                {{ text | objectNameFilter }}</a
              >
            </template>
            <template v-else>
              <t-ellipsis :value="text">
                <template slot="content">
                  <icon-fonts :icon="getIconFonts(record.objectName)" />
                  <a
                    @click="
                      () => {
                        handleDownLoad(record);
                      }
                    "
                  >
                    {{ text | objectNameFilter }}</a
                  >
                </template>
              </t-ellipsis>
            </template>
          </span>
          <span slot="renderStorageClass" slot-scope="text, record">
            {{ text | storageClassFilter }}
          </span>
          <span slot="renderAction" slot-scope="text, record">
            <template v-if="record.isFile">
              <a
                v-if="showPreview(record)"
                @click="
                  () => {
                    handlePreview(record);
                  }
                "
                >{{ $ct("handleOnlinePreview", "预览") }}</a
              >
              <!-- <a-divider type="vertical" v-if="showPreview(record)" /> -->
              <span v-if="showPreview(record)" class="action-margin"></span>
              <a @click="handleView(record)">{{ $ct("detail", "详情") }}</a>
              <span class="action-margin"></span>
              <a @click="handleDownLoad(record)">{{
                $ct("download", "下载")
              }}</a>
              <template v-if="showTypePreview(record)">
                <span class="action-margin"></span>
                <a @click="getViewUrlWebPath(record)">{{
                  $ct("onlineEditing", "在线编辑")
                }}</a>
              </template>
            </template>
          </span>
        </a-table>
      </div>
      <edit-form
        ref="createModal"
        :visible="visible"
        :model="mdl"
        @cancel="handleCancel(0)"
        @ok="
          () => {
            $refs.createModal.form.resetFields(), (visible = false);
          }
        "
      />
      <editDic-form
        ref="subModal"
        :visible="subVisible"
        :loading="subConfirmLoading"
        :model="mdlDic"
        @cancel="handleCancel(1)"
        @ok="handleOkDic()"
      />
      <web-upload
        ref="createPostModal"
        :visible="visibleFile"
        :data="fileData"
        :url="url.webUpload"
        @cancel="handleCancel(2)"
        @ok="handleOkFile"
      />
      <newFile
        ref="newFile"
        :visible="visibleNewFile"
        :loading="subConfirmLoadingNewFile"
        :bucketList="bucketList"
        :model="fileMdl"
        @cancel="
          () => {
            visibleNewFile = false;
          }
        "
        @ok="handleOkChange"
      ></newFile>
      <previewImage
        :imgSrc="imgPreview"
        :visible.sync="imgVisible"
      ></previewImage>
      <previewModal
        :visible.sync="previewVisible"
        :loading="previewLoading"
        ref="previewModal"
      ></previewModal>
    </div>
  </div>
</template>

<script>
import { pdfStreamHandeler } from "@/services/common";
import { STable, Ellipsis, DataGrid } from "@/components";
import editForm from "./edit.vue";
import { dataListMixin } from "@/mixins/dataListMixin";
import { simpleListMixin } from "@/mixins/simpleListMixin";
import editDicForm from "./editDicItem.vue";
import webUpload from "@/components/TopVUI/custom/webupload.vue";
import previewImage from "@/components/TopVUI/custom/previewImage";
import newFile from "./newFile.vue";
import { downloadOss } from "@/utils/TopVUI.js";
import previewModal from "../minio/previewModal"; //预览
import { getToken } from "@/utils/TopVUI";
import { mapGetters } from "vuex";
// import util from '@/utils/util'
import {
  submitForm,
  GetUrlParam,
  getIconFont,
  getTypeByList,
  fileSuffix,
  kkFileViewType,
} from "@/utils/util";
import store from "@/store";
const columns = [
  {
    title: "存储空间",
    dataIndex: "name",
    langCode: "storageSpace",
  },
];

export default {
  name: "TableList",
  mixins: [dataListMixin, simpleListMixin],
  components: {
    STable,
    Ellipsis,
    editForm,
    editDicForm,
    webUpload,
    newFile,
    DataGrid,
    previewImage,
    previewModal,
  },
  data() {
    this.columns = columns;
    return {
      // create model
      previewVisible: false,
      previewLoading: false,
      columnsDicItem: [
        {
          title: "#",
          align: "center",
          langCode: "serialNo",
          width: 50,
          scopedSlots: {
            customRender: "renderSerial",
          },
        },
        {
          title: "文件名",
          dataIndex: "objectName",
          langCode: "fileName",
          scopedSlots: {
            customRender: "renderObjectName",
          },
          customCell: (record, rowIndex) => {
            return {
              style: "color: #1890ff",
            };
          },
          ellipsis: true,
        },
        {
          title: "大小",
          width: 80,
          dataIndex: "size",
          langCode: "sizeText",
          ellipsis: true,
        },
        {
          title: "更新时间",
          width: 150,
          dataIndex: "updateTime",
          ellipsis: true,
          sorter: true,
        },
        {
          title: "存储类型",
          width: 100,
          dataIndex: "storageClass",
          scopedSlots: {
            customRender: "renderStorageClass",
          },
          ellipsis: true,
        },
        {
          title: "操作",
          dataIndex: "action",
          width: 230,
          scopedSlots: {
            customRender: "renderAction",
          },
        },
      ],
      visible: false,
      subVisible: false,
      visibleFile: false,
      subConfirmLoading: false,
      mdl: null,
      mdlDic: null,
      // 高级搜索 展开/关闭
      advanced: false,
      // 查询参数
      queryParam: {},
      queryParamDicItem: {},
      url: {
        webUpload: "/document/oss/multiUpload",
        getBucketList: "/document/oss/getBucketList",
        getPageSet: "/document/oss/getPageSet",
        subAdd: "/document/oss/saveCatalog",
        delFile: "/document/oss/delFile",
      },
      dataSource: [],
      bucketList: [],
      // 加载数据方法 必须为 Promise 对象
      loadData: (parameter) => {
        const requestParameters = Object.assign({}, parameter, this.queryParam);
        return this.$post(this.url.getBucketList, requestParameters).then(
          (res) => {
            const list = {};
            list.pageNo = 1;
            list.pageSize = 20;
            list.rows = [];
            list.totalCount = res.length;
            list.totalPage = Math.ceil(res.length / 20);
            if (res.statusCode != 300) {
              list.rows = res;
              this.queryParamDicItem.bucketName = list.rows[0].name;
              this.destinationBucketName = list.rows[0].name;
              this.queryParamDicItem.endpoint = list.rows[0].extranetEndpoint;
              this.queryParamDicItem.keyPrefix = list.rows[0].keyPrefix;
              this.fetch();
              this.bucketList = res;
            }
            // this.$refs.subList.refresh();
            return list;
          }
        );
      },
      masterSelectedRowKeys: [],
      masterSelectedRows: [],
      info: "",
      fileData: {},
      delData: {},
      visibleNewFile: false,
      fileMdl: null,
      fileCatalog: null,
      destinationKey: "",
      destinationBucketName: "",
      tabelLoading: false,
      subConfirmLoadingNewFile: false,
      imgVisible: false,
      imgPreview: "",
      selectedRowKeysDic: [],
      pagination: {
        pageSize: 20,
        showSizeChanger: true,
        showQuickJumper: true,
        hideOnSinglePage: false,
        onShowSizeChange: (current, pageSize) =>
          this.onShowSizeChange(current, pageSize),
      },
      pageClientHeight: 0,
    };
  },
  filters: {
    objectNameFilter(val) {
      const objectNameMap = val.split("/")[0];
      return val;
    },
    statusFilter(status) {
      const statusMap = {
        0: "禁用",
        1: "启用",
      };
      return statusMap[status];
    },
    storageClassFilter(val) {
      let text = "";
      if (val === "Standard") {
        text = "标准存储";
      } else if (val === "IA") {
        text = "低频访问";
      } else if (val === "Archive") {
        text = "归档存储";
      }
      return text;
    },
  },
  computed: {
    ...mapGetters(["configData"]),
    rowSelection() {
      return {
        selectedRowKeys: this.masterSelectedRowKeys,
        onChange: this.onSelectChangeMaster,
      };
    },
    kkFileView() {
      let index = this.configData.findIndex(
        (item) => item.code === "kkFileView"
      );
      if (index >= 0) {
        return this.configData[index].value;
      } else {
        return "http://192.168.1.216:8012/onlinePreview";
      }
    },
    rowSelectionDic() {
      return {
        selectedRowKeys: this.selectedRowKeysDic,
        onChange: this.onSelectChangeDic,
      };
    },
    // 表格竖向滚动条设置  这里是根据每页数据条数大于等于20的时候出现滚动条
    scrollXY() {
      let height = "";
      height = this.pageClientHeight - 40 - 40 - 22 - 35;
      const tdHeight = this.dataSource?.length * 40 ?? 0;
      return this.dataSource?.length >= 20 || height < tdHeight
        ? { y: height, x: "100%" }
        : { x: "100%" };
    },
  },
  beforeDestroy() {
    this.destroyResizeEvent();
  },
  mounted() {
    // this.$refs.subList.refresh();
    this.resizeHandler();
    this.initResizeEvent();
  },
  methods: {
    // 重新调整表格高度
    resizeHandler() {
      // 获取页面内容的高度
      this.pageClientHeight = document.getElementsByClassName(
        "page-common-content"
      )[0]?.clientHeight;
    },
    // 字体图标匹配
    getIconFonts(text) {
      return getIconFont(text);
    },
    rowClassName(row) {
      return row.name === this.info?.name ? "bg-bray" : ""; // 每条数据的唯一识别值
    },
    // 行点击事件
    rowClick(record, index) {
      const that = this;
      that.info = record;
      // that.masterSelectedRowKeys = index;
      that.selectedRowKeysDic = [];
      that.queryParamDicItem.bucketName = record.name;
      that.queryParamDicItem.endpoint = record.extranetEndpoint;
      that.queryParamDicItem.keyPrefix = record.keyPrefix;
      that.fileData = that.queryParamDicItem;
      that.fetch();
      that.destinationBucketName = record.name;
    },
    handleLoadData(record) {
      this.queryParamDicItem.bucketName = record.bucketName;
      this.queryParamDicItem.endpoint = record.endpoint;
      this.queryParamDicItem.keyPrefix = record.uuid;
      this.queryParamDicItem.nextMarker = " ";
      this.queryParamDicItem.search = " ";
      this.fetch();
    },
    // 新增目录
    handleAddDic() {
      if (!this.info) {
        this.$message.info("请先选中左侧表格的数据");
      } else {
        var mdlData = {
          bucketName: this.info.name,
          endpoint: this.info.extranetEndpoint,
          keyPrefix: this.info.keyPrefix,
        };
        if (this.queryParamDicItem.keyPrefix) {
          this.mdlDic = this.queryParamDicItem;
        } else {
          this.mdlDic = mdlData;
        }
        this.subVisible = true;
      }
      this.$refs.subModal.title = "新增";
      const form = this.$refs.subModal.form;
      form.resetFields(); // 清理表单数据（可不做）
    },
    // 更新
    handleOkDic: function() {
      let form = this.$refs.subModal.form;
      let url = "";
      form.validateFields((errors, values) => {
        if (!errors) {
          this.subConfirmLoading = true;
          if (values.uuid) {
            url = this.url.subUpdate;
          } else {
            url = this.url.subAdd;
          }
          this.$post(url, values)
            .then((res) => {
              if (res === 1 || res.statusCode === 200) {
                this.subVisible = false;
                this.subRows = null;
                this.fetch();
                this.$message.success(
                  res.message ? res.message : "操作成功",
                  1.5
                );
              } else {
                this.$message.error(
                  res.message ? res.message : "操作失败",
                  1.5
                );
              }
            })
            .finally(() => {
              this.subConfirmLoading = false;
            });
        }
      });
    },
    // 上传
    handleUpLoad() {
      if (this.fileData.bucketName) {
        this.visibleFile = true;
        this.$refs.createPostModal.add();
      } else {
        this.$message.info("请先选中需要操作的数据");
        return true;
      }
    },
    // 图片预览筛选
    showPreview(e) {
      const imgType = kkFileViewType;
      return getTypeByList(imgType, e.objectName);
    },
    // 预览
    handlePreview(e) {
      this.imgPreview = "";
      this.$refs.previewModal.fileUrl = "";
      this.$nextTick(() => {
        let url =
          "https://" + e.bucketName + "." + e.endpoint + "/" + e.objectName;
        const medieaType = [".jpg", ".jpeg", ".png", ".gif"];
        const videoType = [".mp3", ".wav", ".mp4", ".flv"];
        const flag = getTypeByList(medieaType, e.objectName);
        const video = getTypeByList(videoType, e.objectName);
        if (flag) {
          this.imgVisible = true;
          this.imgPreview = url;
        } else if (video) {
          this.$refs.previewModal.type = "video";
          this.$refs.previewModal.fileUrl = url;
          this.previewVisible = true;
          this.previewLoading = true;
          this.previewLoading = false;
        } else {
          this.$refs.previewModal.type = "file";
          this.$refs.previewModal.fileUrl =
            this.kkFileView +
            "/onlinePreview?url=" +
            encodeURIComponent(Base64.encode(url)) +
            "&watermarkTxt=" +
            //水印内容
            encodeURIComponent("") +
            "&token=" +
            getToken();
          this.previewVisible = true;
        }
      });
    },
    // 预览详情
    handleView(e) {
      this.mdl = {
        bucketName: e.objectName,
        acl: "default",
        url: "https://" + e.bucketName + "." + e.endpoint + "/" + e.objectName,
      };
      this.visible = true;
    },
    handleOkFile() {
      this.visibleFile = false;
      this.fetch();
    },
    // 返回
    handleBack() {
      delete this.queryParamDicItem["keyPrefix"];
      delete this.queryParamDicItem["nextMarker"];
      delete this.queryParamDicItem["search"];
      // this.selectedRowKeysDic = [];
      this.fetch();
    },
    // 取消
    handleCancel(type) {
      if (type === 0) {
        this.visible = false;
      } else if (type === 1) {
        this.subVisible = false;
      } else {
        this.visibleFile = false;
      }
    },
    // 删除
    handleSub() {
      const that = this;
      let uuids = [],
        endpoint = "",
        bucketName = "";
      if (that.selectedRowKeysDic.length === 0) {
        that.$message.warn("请先勾选需要的删除的数据");
        return true;
      } else {
        that.$refs.subList.selectedRows.forEach((e, index) => {
          uuids.push(e.uuid);
          endpoint = e.endpoint;
          bucketName = e.bucketName;
        });
      }
      that.$confirm({
        title: "警告",
        content: `确定要执行该操作吗?`,
        okText: "删除",
        okType: "danger",
        cancelText: "取消",
        onOk() {
          // 在这里调用删除接口
          that
            .$post(that.url.delFile, {
              uuids: uuids.toString(),
              endpoint: endpoint,
              bucketName: bucketName,
            })
            .then((res) => {
              if (res.statusCode === 200) {
                that.$message.success(res.message);
                that.fetch();
                that.selectedRowKeysDic = [];
              } else {
                that.$message.info(res.message);
              }
            });
          return new Promise((resolve, reject) => {
            setTimeout(Math.random() > 0.5 ? resolve : reject, 1000);
          }).catch(() => console.log("Oops errors!"));
        },
        onCancel() {
          console.log("Cancel");
        },
      });
    },
    // 下载
    handleDownLoad(e) {
      downloadOss(e.bucketName, e.endpoint, e.objectName);
    },
    // 行勾选事件
    onSelectChangeDic(selectedRowKeys, selectedRows) {
      selectedRows.forEach((e, index) => {
        if (index === 0) {
          this.delData.uuids = e.uuid;
          this.delData.endpoint = e.endpoint;
          this.delData.bucketName = e.bucketName;
        } else {
          this.delData.uuids = this.delData.uuids + "," + e.uuid;
        }
      });
      this.selectedRowKeysDic = selectedRowKeys;
      this.$refs.subList.selectedRows = selectedRows;
    },
    // 在线编辑
    getViewUrlWebPath(record) {
      // console.log("d-record = " , record)
      let url =
        "https://" +
        record.bucketName +
        "." +
        record.endpoint +
        "/" +
        record.key;
      let reg = /^((https|http|ftp|rtsp|mms)?:\/\/)[^\s]+/;
      if (!reg.test(url)) {
        this.$message.info("请输入正确的file url！");
        return;
      }
      const fileName = url;
      const fileStrArr = fileName.split(".");
      const suffix = fileStrArr[fileStrArr.length - 1];

      let result = fileSuffix.some((item) => {
        return item === suffix;
      });

      if (!result) {
        this.$message.info("不支持该文件类型");
        return;
      }
      this.loading = true;
      const params = {
        fileUrl: url,
        uuid: record.size,
        uploadType: "oss",
      };
      this.$post("/document/wps/getViewUrlWebPath", params, null)
        .then((res) => {
          // console.log("d-wps = ", res)
          store.commit("SET_WPSURL", res.Token.wpsUrl);
          localStorage.setItem("wpsUrl", res.Token.wpsUrl);
          const jump = this.$router.resolve({ name: "viewFile" });
          window.open(jump.href, "_blank");
        })
        .catch(() => {
          this.$message.info("请求错误！");
          this.loading = false;
        });
    },
    // 判断是否显示在线编辑按钮
    showTypePreview(e) {
      return getTypeByList(fileSuffix, e.objectName);
    },
    // 更换存储空间
    handleChangeFile() {
      if (this.selectedRowKeysDic.length === 0) {
        this.$message.info("请先选中需要操作的数据！");
      } else {
        const flag = this.$refs.subList.selectedRows.some((item) => {
          return item.isFile == false;
        });
        if (flag) {
          this.$message.info("文件夹不能移动！");
        } else {
          this.fileMdl = {
            sourceBucketName: this.$refs.subList.selectedRows[0].bucketName,
            endpoint: this.$refs.subList.selectedRows[0].endpoint,
            sourceKey: this.selectedRowKeysDic.toString(),
          };
          this.visibleNewFile = true;
        }
      }
    },
    // 确定更换存储空间
    handleOkChange() {
      const form = this.$refs.newFile.form;
      form.validateFields((errors, values) => {
        if (!errors) {
          this.subConfirmLoadingNewFile = true;
          this.$post("/document/oss/ossFileMoveBucket", values)
            .then((res) => {
              if (res.statusCode === 200) {
                this.$message.success(res.message);
                this.visibleNewFile = false;
                this.selectedRowKeysDic = [];
                this.fetch();
              } else {
                this.$message.warn(res.message);
              }
            })
            .finally(() => {
              this.subConfirmLoadingNewFile = false;
            });
        }
      });
    },
    // 更改文件目录
    handleChangeFileCatalog() {
      if (this.selectedRowKeysDic.length === 0) {
        this.$message.info("请先勾选需要操作的数据！");
      } else {
        const flag = this.$refs.subList.selectedRows.some((item) => {
          return item.isFile == false;
        });
        if (flag) {
          this.$message.info("文件夹不能移动！");
        } else {
          this.fileCatalog = {
            sourceBucketName: this.$refs.subList.selectedRows[0].bucketName,
            endpoint: this.$refs.subList.selectedRows[0].endpoint,
            sourceKey: this.selectedRowKeysDic.toString(),
          };
        }
      }
    },
    // 确定更换文件夹目录
    handleOkFileCatalog() {
      this.tabelLoading = true;
      let destinationKeyList = [];
      this.$refs.subList.selectedRows.forEach((e) => {
        if (e.objectName.indexOf("/") > 0) {
          let arr = e.objectName.split("/");
          destinationKeyList.push(
            this.queryParamDicItem.keyPrefix + arr[arr.length - 1]
          );
        } else {
          destinationKeyList.push(
            this.queryParamDicItem.keyPrefix + e.objectName
          );
        }
      });
      this.fileCatalog.destinationKey = destinationKeyList.toString();
      this.fileCatalog.destinationBucketName = this.destinationBucketName;
      this.$post("/document/oss/ossFileMoveFolder", this.fileCatalog)
        .then((res) => {
          if (res.statusCode === 200) {
            this.$message.success(res.message);
            this.visibleNewFile = false;
            this.selectedRowKeysDic = [];
            this.fetch();
            this.fileCatalog = null;
          } else {
            this.$message.warn(res.message);
          }
        })
        .finally(() => {
          this.tabelLoading = false;
        });
    },
    // 获取列表
    fetch(params) {
      this.$post(this.url.getPageSet, this.queryParamDicItem).then((res) => {
        const pager = {
          ...this.pagination,
        };
        pager.total = res.rows.length;
        this.dataSource = res.rows;
        this.pagination = pager;
      });
    },
    //监听resize
    initResizeEvent() {
      window.addEventListener("resize", this.resizeHandler, false);
    },
    //移除resize
    destroyResizeEvent() {
      window.removeEventListener("resize", this.resizeHandler);
    },
  },
};
</script>

<style lang="less"></style>
